<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <title>评委主页</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <script type="text/javascript" src="assets/js/jquery-1.10.2.js"></script>
        <script src="./assets/js/jspdf.debug.js"></script>
        <script src="./assets/js/html2canvas.js"></script>
        <style>
            body {
                font-family: 'Sans', sans-serif;
                background-size:cover;
            }
            table{
                width: 600px;
                text-align: center;
            }
            .entry-receipt-PDF{
                text-align: center;
                background-color: #fff;
                color:#000;                
                padding: 20px;
                padding-top:5px;
                position: relative;                
                width:600px;/*595.28,841.89*/
                height:840px;
                left:50%;
                margin-left:-300px;
                margin-top:50px;
                border:1px solid #000;

            }
            .entry-receipt-table-PDF{
                width: 580px;
                heoght: 820px
                    /*display: flex;
                    align-items: center;*/
            }
            .button-center {
                margin-top: 10px;
                text-align:center;
            }
            .btn {
                width: 220px;
                height: 40px;
                font-size: 20px;
            }
            .table-container{
                position: relative; 
                display: flex;
                width:1500px;
                left:50%;
                margin-left:-750px;
                margin-top:50px;
            }
            .judge-div{
                text-align: center;
                background-color: #fff;
                color:#000;                
                padding: 10px;
                padding-top:5px;
                position: relative;                
                margin-top:50px;
            }
            .top{
                /* 设置宽度高度背景颜色 */
                height: 40px; /*高度改为自动高度*/
                width:100%;
                margin-left: 0;
                background:rgb(189, 181, 181);
                position: relative; /*固定在顶部*/
                top: 0;/*离顶部的距离为0*/
                margin-bottom: 5px;
            }
            .top ul{
                /* 清除ul标签的默认样式 */
                width: auto;/*宽度也改为自动*/
                list-style-type: none;
                white-space:nowrap;
                overflow: hidden;
                margin-left: 5%;
                /* margin-top: 0;          */
                padding: 0;

            }
            .top li {
                float:left; /* 使li内容横向浮动，即横向排列  */
                margin-right:2%;  /* 两个li之间的距离*/
                position: relative;
                overflow: hidden;
            }

            .top li a{
                /* 设置链接内容显示的格式*/
                display: block; /* 把链接显示为块元素可使整个链接区域可点击 */
                color:white;
                text-align: center;
                padding: 3px;
                overflow: hidden;
                text-decoration: none; /* 去除下划线 */

            }
            .top li a:hover{
                /* 鼠标选中时背景变为黑色 */
                background-color: #111;
            }
            .top ul li ul{
                /* 设置二级菜单 */
                margin-left: -0.2px;
                background:rgb(189, 181, 181);
                position: relative;
                display: none; /* 默认隐藏二级菜单的内容 */

            }
            .top ul li ul li{
                /* 二级菜单li内容的显示 */

                float:none;
                text-align: center;
            }
            .top ul li:hover ul{
                /* 鼠标选中二级菜单内容时 */
                display: block;
            }
        </style>
    </head>
    <body>
        <div class="top">
            <center> 
                <ul>
                    <li><a href="#" onclick="window_leader(0)">个人注册信息</a></li>
                    <li>
                        <a href="#">比赛安排</a>
                        <ul>
                            <li><a href="#" onclick="window_leader(1)">评委场地安排</a></li>
                            <li><a href="#" onclick="window_leader(2)">评委打分信息</a></li>
                        </ul>
                    </li> 
                    <li><a href="#" onclick="window_leader(3)">参赛回执</a></li>
                </ul>
            </center>      
        </div>
        <?PHP
        if (!empty($_GET['email'])) {$email = $_GET['email'];} else {$email = '';}
        $mysqli = mysqli_init();
        $mysqli->options(MYSQLI_OPT_CONNECT_TIMEOUT, 2); //设置超时时间
        $mysqli->real_connect('127.0.0.1', 'root', 'mysql');
        $sql = "CREATE DATABASE IF NOT EXISTS CUPT DEFAULT CHARSET utf8 COLLATE utf8_general_ci;";
        if ($mysqli->query($sql) == TRUE) {
        //printf("Table CUPT successfully created.\n");
        }
        mysqli_select_db($mysqli, "CUPT");
        $sql="select * from judge where `email`='$email'";
        $rst = $mysqli->query($sql);
        while ($row = mysqli_fetch_assoc($rst)) {
        $string1='';
        $string1=$string1."<tr><th>Email</th><td>$email</td></tr>";
        $name = $row['name'];
        $string1=$string1."<tr><th>姓名</th><td>$name</td></tr>";
        $sex = $row['sex'];
        $string1=$string1."<tr><th>性别</th><td>$sex</td></tr>";
        $school = $row['school'];
        $string1=$string1."<tr><th>学校</th><td>$school</td></tr>";
        $phone_number = $row['phone_number'];
        $string1=$string1."<tr><th>手机号码</th><td>$phone_number</td></tr>";
        if($row['chairman_qualifications']=='b'){$chairman_qualifications ='否';}
        elseif($row['chairman_qualifications']=='a'){$chairman_qualifications ='是';}
        $string1=$string1."<tr><th>是否作为主席</th><td>$chairman_qualifications</td></tr>";
        $clothing_model = $row['clothing_model'];
        $string1=$string1."<tr><th>衣服尺码</th><td>$clothing_model</td></tr>";
        $bank_account=$row['bank_account'];
        $string1=$string1."<tr><th>银行卡号</th><td>$bank_account</td></tr>";
        $bank=$row['bank'];
        $string1=$string1."<tr><th>开户银行</th><td>$bank</td></tr>";
        }
        ?>
        <div class='judge-div' id='judge_information'>
            <center>
                <table  border="1"  cellspacing="0">
                    <tr>
                        <th colspan="2">个人注册信息</th>
                    </tr>
                    <?PHP echo $string1; ?>
                </table>
                <div class="button-center">
                    <a href="judge-signup.html?email=<?PHP echo $email;?>"><button class="btn">修改个人注册信息</button></a>
                </div>
            </center>
        </div>

        <?PHP

        $sql="select CONCAT(school_information_list.school_number,judge.chairman_qualifications) as judge_number from judge inner join school_information_list on judge.school=school_information_list.school where judge.email='$email';
        ";
        $rst = $mysqli->query($sql);
        while ($row = mysqli_fetch_assoc($rst)) {
        $judge_number=$row['judge_number'];
        }

        $sql="select *,sl_1.school as school_1,sl_2.school as school_2,sl_3.school as school_3 from rounds_match_list inner join school_information_list as sl_1 inner join school_information_list as sl_2 inner join school_information_list as sl_3 on (rounds_match_list.school_1_number=sl_1.school_number and rounds_match_list.school_2_number=sl_2.school_number and rounds_match_list.school_3_number=sl_3.school_number) where (`judge_1_number`='$judge_number' or `judge_2_number`='$judge_number' or `judge_3_number`='$judge_number' or `judge_4_number`='$judge_number' or `judge_5_number`='$judge_number');";
        $rst = $mysqli->query($sql);
        $string2_1='';
        while ($row = mysqli_fetch_assoc($rst)) {

        $site = $row['site'];
        $string2_1=$string2_1."<td>$site</td>";
        $round = $row['round'];
        $string2_1=$string2_1."<td>$round</td>";
        $session = $row['session'];
        $string2_1=$string2_1."<td>$session</td>";
        $school_1 = $row['school_1'];
        $string2_1=$string2_1."<td>$school_1</td>";
        $school_2 = $row['school_2'];
        $string2_1=$string2_1."<td>$school_2</td>";
        $school_3 = $row['school_3'];
        $string2_1=$string2_1."<td>$school_3</td>";

        $chairman_number = $row['chairman_number'];
        $judge_1_number = $row['judge_1_number'];
        $judge_2_number = $row['judge_2_number'];
        $judge_3_number = $row['judge_3_number'];
        $judge_4_number = $row['judge_4_number'];
        $judge_5_number = $row['judge_5_number'];

        $sql1="select j_c.name as chairman ,j_1.name as judge_1 ,j_2.name as judge_2 ,j_3.name as judge_3 ,j_4.name as judge_4 ,j_5.name as judge_5 
        from school_information_list 
        left join judge as j_c on(school_information_list.school=j_c.school and (j_c.chairman_qualifications=right('$chairman_number',1) and school_information_list.school_number=left('$chairman_number',1)))
        left join judge as j_1 on(school_information_list.school=j_1.school and (j_1.chairman_qualifications=right('$judge_1_number',1) and school_information_list.school_number=left('$judge_1_number',1)))
        left join judge as j_2 on(school_information_list.school=j_2.school and (j_2.chairman_qualifications=right('$judge_2_number',1) and school_information_list.school_number=left('$judge_2_number',1)))
        left join judge as j_3 on(school_information_list.school=j_3.school and (j_3.chairman_qualifications=right('$judge_3_number',1) and school_information_list.school_number=left('$judge_3_number',1)))
        left join judge as j_4 on(school_information_list.school=j_4.school and (j_4.chairman_qualifications=right('$judge_4_number',1) and school_information_list.school_number=left('$judge_4_number',1)))
        left join judge as j_5 on(school_information_list.school=j_5.school and (j_5.chairman_qualifications=right('$judge_5_number',1) and school_information_list.school_number=left('$judge_5_number',1)))
        limit 1;";

        $rst1 = $mysqli->query($sql1);
        if($rst1!=null&&$rst1->num_rows!=0){
        while ($row1 = mysqli_fetch_assoc($rst1)) {
        $chairman = $row1['chairman'];
        $string2_1=$string2_1."<td>$chairman</td>";
        $judge_1 = $row1['judge_1'];
        $string2_1=$string2_1."<td>$judge_1</td>";
        $judge_2 = $row1['judge_2'];
        $string2_1=$string2_1."<td>$judge_2</td>";
        $judge_3 = $row1['judge_3'];
        $string2_1=$string2_1."<td>$judge_3</td>";
        $judge_4 = $row1['judge_4'];
        $string2_1=$string2_1."<td>$judge_4</td>";
        $judge_5 = $row1['judge_5'];
        $string2_1=$string2_1."<td>$judge_5</td>";
        }
        }else{
        $string2_1=$string2_1."<td>$chairman_number</td>";
        $string2_1=$string2_1."<td>$judge_1_number</td>";
        $string2_1=$string2_1."<td>$judge_2_number</td>";
        $string2_1=$string2_1."<td>$judge_3_number</td>";
        $string2_1=$string2_1."<td>$judge_4_number</td>";
        $string2_1=$string2_1."<td>$judge_5_number</td>";
        }

        $string2_1="<tr>".$string2_1."</tr>";
        }

        $sql="select *,sl_1.school as school_1 ,sl_2.school as school_2 ,sl_3.school as school_3 ,j_c.name as chairman,j_1.name as judge_1,j_2.name as judge_2,j_3.name as judge_3,j_4.name as judge_4,j_5.name as judge_5
        from session_match_list 
        inner join rounds_match_list 
        on (session_match_list.site=rounds_match_list.site and session_match_list.round=rounds_match_list.round and session_match_list.session=rounds_match_list.session) 
        inner join school_information_list as sl_1 on (rounds_match_list.school_1_number=sl_1.school_number) 
        inner join school_information_list as sl_2 on (rounds_match_list.school_2_number=sl_2.school_number) 
        inner join school_information_list as sl_3 on (rounds_match_list.school_3_number=sl_3.school_number)
        left join judge as j_c on (left(rounds_match_list.chairman_number,1)=j_c.school_number and right(rounds_match_list.chairman_number,1)=j_c.chairman_qualifications) 
        left join judge as j_1 on (left(rounds_match_list.judge_1_number,1)=j_1.school_number and right(rounds_match_list.judge_1_number,1)=j_1.chairman_qualifications) 
        left join judge as j_2 on (left(rounds_match_list.judge_2_number,1)=j_2.school_number and right(rounds_match_list.judge_2_number,1)=j_2.chairman_qualifications) 
        left join judge as j_3 on (left(rounds_match_list.judge_3_number,1)=j_3.school_number and right(rounds_match_list.judge_3_number,1)=j_3.chairman_qualifications) 
        left join judge as j_4 on (left(rounds_match_list.judge_4_number,1)=j_4.school_number and right(rounds_match_list.judge_4_number,1)=j_4.chairman_qualifications) 
        left join judge as j_5 on (left(rounds_match_list.judge_5_number,1)=j_5.school_number and right(rounds_match_list.judge_5_number,1)=j_5.chairman_qualifications) 
        where (judge_1_number='$judge_number' or judge_2_number='$judge_number' or judge_3_number='$judge_number' or judge_4_number='$judge_number' or judge_5_number='$judge_number');";
        $rst = $mysqli->query($sql);
        $string2_2='';
        $identify_list=array('','正方','反方','评论方');
        while ($row = mysqli_fetch_assoc($rst)) {
        $string2_2_1='';
        $string2_2_2='';


        $school_[1] = $row['school_1'];
        $school_[2] = $row['school_2'];
        $school_[3] = $row['school_3'];

        $judge_number=array('','','','','','');
        $judge_=array('','','','','','');
        $judge_score=array(
        array('','','','','',''),
        array('','','','','',''),
        array('','','','','',''),
        array('','','','','','')
        );

        $string2_2_1=$string2_2_1."<tr><th colspan='7' >赛场信息</th><th colspan='5'>评委打分</th></tr>";
        $string2_2_1=$string2_2_1."<th>场地号</th><th>轮次</th><th>场次</th><th>本场题目</th><th>主席</th><th>学校</th><th>队伍身份</th>";
        for($judge_index=1;$judge_index<=5;$judge_index++){
        $judge_number[$judge_index]=$row["judge_"."$judge_index"."_number"];
        $judge_[$judge_index]=$row["judge_"."$judge_index"];
        $string2_2_1=$string2_2_1."<td>".$judge_[$judge_index]."</td>";

        for($school_index=1;$school_index<=3;$school_index++){
        $judge_score[$judge_index][$school_index] = $row["judge_"."$judge_index"."_score_"."$school_index"];

        }
        }
        $string2_2_1="<tr>".$string2_2_1."</tr>";

        $site = $row['site'];
        $string2_2_2=$string2_2_2."<td rowspan='3'>$site</td>";
        $round = $row['round'];
        $string2_2_2=$string2_2_2."<td rowspan='3'>$round</td>";
        $session = $row['session'];
        $string2_2_2=$string2_2_2."<td rowspan='3'>$session</td>";
        $accept_question = $row['accept_question'];
        $string2_2_2=$string2_2_2."<td rowspan='3'>$accept_question</td>";
        $chairman = $row['chairman'];
        $string2_2_2=$string2_2_2."<td rowspan='3'>$chairman</td>";

        for($identify=1;$identify<=3;$identify++){
        $sub_string2_2_2='';
        $sub_string2_2_2=$sub_string2_2_2."<td>$school_[$identify]</td>";
        $sub_string2_2_2=$sub_string2_2_2."<td>$identify_list[$identify]</td>";

        for($judge_index=1;$judge_index<=5;$judge_index++){
        $sub_string2_2_2=$sub_string2_2_2."<td>".$judge_score[$judge_index][$identify]."</td>";
        }

        if($identify==1){
        $string2_2_2="<tr>".$string2_2_2.$sub_string2_2_2."</tr>";
        }else{
        $string2_2_2=$string2_2_2."<tr>".$sub_string2_2_2."</tr>";
        }


        }


        $string2_2_2="<tr>".$string2_2_2."</tr>";
        $string2_2=$string2_2.$string2_2_1.$string2_2_2;
        }
        ?>      


        <div class='judge-div' id='judge_site'>
            <center>
                <table border="1"  cellspacing="0" style='width: 1600px;'>
                    <tr>
                        <th colspan="12">评委场地安排</th>
                    </tr>
                    <tr>
                        <th>场地号</th><th>轮次</th><th>场次</th><th>正方学校</th><th>反方学校</th><th>评论方学校</th><th>主席</th><th>评委1</th><th>评委2</th><th>评委3</th><th>评委4</th><th>评委5</th>
                    </tr>
                    <?PHP echo $string2_1;?>
                </table>
            </center>
        </div>

        <div class='judge-div' id='judge_score'>
            <center>
                <table  border="1"  cellspacing="0" style='width: 1600px;'>
                    <tr>
                        <th colspan="12">评委打分信息</th>
                    </tr>
                    <?PHP echo $string2_2;?>
                </table>
            </center>
        </div>
        <?PHP
        $string4="<tr><th>学校名称</th><td colspan='5'>$school</td></tr>";
        $string4=$string4."<tr><th>类别</th><th>姓名</th><th>性别</th><th>职称</th><th>手机</th><th>邮箱</th></tr>";

        $sql="select * from participant inner join school_information_list on participant.email=school_information_list.email;";
        $rst = $mysqli->query($sql);
        if($rst->num_rows!=0){
        $sub_string4="<tr><th rowspan='$rst->num_rows'>联系人</th>";
        while ($row = mysqli_fetch_assoc($rst)) {
        $name=$row['name'];
        $sex=$row['sex'];
        $job_title=$row['job_title'];
        $phone_number=$row['phone_number'];
        $email=$row['email'];
        $sub_string4=$sub_string4."<td>$name</td>";
        $sub_string4=$sub_string4."<td>$sex</td>";
        $sub_string4=$sub_string4."<td>$job_title</td>";
        $sub_string4=$sub_string4."<td>$phone_number</td>";
        $sub_string4=$sub_string4."<td>$email</td>";
        $sub_string4=$sub_string4."</tr><tr>";
        }
        $sub_string4=substr($sub_string4, 0, -4);//去掉末尾的<tr>
        $string4=$string4.$sub_string4;
        }

        $sql="select * from participant where `school`='$school' and `team_position`='领队';";
        $rst = $mysqli->query($sql);
        if($rst->num_rows!=0){
        $sub_string4="<tr><th rowspan='$rst->num_rows'>领队</th>";
        while ($row = mysqli_fetch_assoc($rst)) {
        $name=$row['name'];
        $sex=$row['sex'];
        $job_title=$row['job_title'];
        $phone_number=$row['phone_number'];
        $email=$row['email'];
        $sub_string4=$sub_string4."<td>$name</td>";
        $sub_string4=$sub_string4."<td>$sex</td>";
        $sub_string4=$sub_string4."<td>$job_title</td>";
        $sub_string4=$sub_string4."<td>$phone_number</td>";
        $sub_string4=$sub_string4."<td>$email</td>";
        $sub_string4=$sub_string4."</tr><tr>";
        }
        $sub_string4=substr($sub_string4, 0, -4);//去掉末尾的<tr>
        $string4=$string4.$sub_string4;
        }

        $sql="select * from judge where `school`='$school';";
        $rst = $mysqli->query($sql);
        if($rst->num_rows!=0){
        $sub_string4="<tr><th rowspan='$rst->num_rows'>评委</th>";
        while ($row = mysqli_fetch_assoc($rst)) {
        $name=$row['name'];
        $sex=$row['sex'];
        $job_title=$row['job_title'];
        $phone_number=$row['phone_number'];
        $email=$row['email'];
        $sub_string4=$sub_string4."<td>$name</td>";
        $sub_string4=$sub_string4."<td>$sex</td>";
        $sub_string4=$sub_string4."<td>$job_title</td>";
        $sub_string4=$sub_string4."<td>$phone_number</td>";
        $sub_string4=$sub_string4."<td>$email</td>";
        $sub_string4=$sub_string4."</tr><tr>";
        }
        $sub_string4=substr($sub_string4, 0, -4);//去掉末尾的<tr>
        $string4=$string4.$sub_string4;
        }

        $sql="select * from participant where `school`='$school' and `school_position`='学生' and (`team_position`='参赛队员' or `team_position`='参赛队长') ;";
        $rst = $mysqli->query($sql);
        if($rst->num_rows!=0){
        $sub_string4="<tr><th rowspan='$rst->num_rows'>参赛学生</th>";
        while ($row = mysqli_fetch_assoc($rst)) {
        $name=$row['name'];
        $sex=$row['sex'];
        $job_title=$row['job_title'];
        $phone_number=$row['phone_number'];
        $email=$row['email'];
        $sub_string4=$sub_string4."<td>$name</td>";
        $sub_string4=$sub_string4."<td>$sex</td>";
        $sub_string4=$sub_string4."<td>$job_title</td>";
        $sub_string4=$sub_string4."<td>$phone_number</td>";
        $sub_string4=$sub_string4."<td>$email</td>";
        $sub_string4=$sub_string4."</tr><tr>";
        }
        $sub_string4=substr($sub_string4, 0, -4);//去掉末尾的<tr>
        $string4=$string4.$sub_string4;
        }

        $sql="select * from participant where `school`='$school' and `school_position`='教师' and (`team_position`='观摩师生') ;";
        $rst = $mysqli->query($sql);
        if($rst->num_rows!=0){
        $sub_string4="<tr><th rowspan='$rst->num_rows'>观摩教师</th>";
        while ($row = mysqli_fetch_assoc($rst)) {
        $name=$row['name'];
        $sex=$row['sex'];
        $job_title=$row['job_title'];
        $phone_number=$row['phone_number'];
        $email=$row['email'];
        $sub_string4=$sub_string4."<td>$name</td>";
        $sub_string4=$sub_string4."<td>$sex</td>";
        $sub_string4=$sub_string4."<td>$job_title</td>";
        $sub_string4=$sub_string4."<td>$phone_number</td>";
        $sub_string4=$sub_string4."<td>$email</td>";
        $sub_string4=$sub_string4."</tr><tr>";
        }
        $sub_string4=substr($sub_string4, 0, -4);//去掉末尾的<tr>
        $string4=$string4.$sub_string4;
        }

        $sql="select * from participant where `school`='$school' and `school_position`='学生' and (`team_position`='观摩师生') ;";
        $rst = $mysqli->query($sql);
        if($rst->num_rows!=0){
        $sub_string4="<tr><th rowspan='$rst->num_rows'>观摩学生</th>";
        while ($row = mysqli_fetch_assoc($rst)) {
        $name=$row['name'];
        $sex=$row['sex'];
        $job_title=$row['job_title'];
        $phone_number=$row['phone_number'];
        $email=$row['email'];
        $sub_string4=$sub_string4."<td>$name</td>";
        $sub_string4=$sub_string4."<td>$sex</td>";
        $sub_string4=$sub_string4."<td>$job_title</td>";
        $sub_string4=$sub_string4."<td>$phone_number</td>";
        $sub_string4=$sub_string4."<td>$email</td>";
        $sub_string4=$sub_string4."</tr><tr>";
        }
        $sub_string4=substr($sub_string4, 0, -4);//去掉末尾的<tr>
        $string4=$string4.$sub_string4;
        }

        $sql="select * from participant where `school`='$school' and committee='是';";
        $rst = $mysqli->query($sql);
        if($rst->num_rows!=0){
        $sub_string4="<tr><th rowspan='$rst->num_rows'>竞赛委员会委员（请出现在竞委会名单中的高校填写）</th>";
        while ($row = mysqli_fetch_assoc($rst)) {
        $name=$row['name'];
        $sex=$row['sex'];
        $job_title=$row['job_title'];
        $phone_number=$row['phone_number'];
        $email=$row['email'];
        $sub_string4=$sub_string4."<td>$name</td>";
        $sub_string4=$sub_string4."<td>$sex</td>";
        $sub_string4=$sub_string4."<td>$job_title</td>";
        $sub_string4=$sub_string4."<td>$phone_number</td>";
        $sub_string4=$sub_string4."<td>$email</td>";
        $sub_string4=$sub_string4."</tr><tr>";
        }
        $sub_string4=substr($sub_string4, 0, -4);//去掉末尾的<tr>
        $string4=$string4.$sub_string4;
        }

        $sql="select a.cnt1+b.cnt2 from   (select count(*) cnt1 from participant where `school`='$school') a,   (select count(*) cnt2 from judge where `school`='$school') b;";
        $rst = $mysqli->query($sql);
        while ($row = mysqli_fetch_assoc($rst)) {
        $total_people_number=$row['a.cnt1+b.cnt2'];
        }
        $string4=$string4."<tr><th>总人数</th><td colspan='5'>".$total_people_number."</td></tr>";
        $sql="select invoice_title,taxpayer_identification_number from school_information_list where school='$school'";
        $rst = $mysqli->query($sql);
        while ($row = mysqli_fetch_assoc($rst)) {
        $invoice_title=$row['invoice_title'];
        $string4=$string4."<tr><th>发票抬头</th><td colspan='5'>".$invoice_title."</td></tr>";
        $taxpayer_identification_number=$row['taxpayer_identification_number'];
        $string4=$string4."<tr><th>纳税人识别号</th><td colspan='5'>".$taxpayer_identification_number."</td></tr>";
        }
        ?>
        <div id="receipt">
            <div id="renderPdf" class="entry-receipt-PDF">
                <h3>2019年CUPT中南赛区回执</h3>
                <div>
                    <table class width="580px" height="665px" border="1" cellspacing="0">    
                        <?PHP
                        echo $string4;
                        ?>
                    </table>
                </div>
                <div style="text-align:left;margin-left: 50%;">
                    <span style="">学校院系名称（盖章）：<br/><br/><br/>
                        领队签字：</span><br/>
                </div>

                <div style="text-align:right;margin-top:16px;"><span id="date" style=""></span></div>
            </div>    

            <div class="button-center">
                <button id="exportToPdf_butten" class="btn" onclick="exportToPdf()">将信息回执保存为PDF</button>
            </div> 
        </div>

        <script type="text/javascript">
            window.onload = function () {
                var d = new Date();
                var date = d.getFullYear() + "年" + (d.getMonth() + 1) + "月" + d.getDate() + "日";
                document.getElementById("date").innerText = date;
                window_leader(0);
            }
            window_leader_id_list = ['judge_information', 'judge_site', 'judge_score', 'receipt'];
            function window_leader(index) {
                for (i = 0; i < window_leader_id_list.length; i++) {
                    if (i == index) {
                        document.getElementById(window_leader_id_list[i]).style.visibility = "visible";//显示
                        document.getElementById(window_leader_id_list[i]).style.display = "";//显
                    } else {
                        document.getElementById(window_leader_id_list[i]).style.visibility = "hidden";//隐藏
                        document.getElementById(window_leader_id_list[i]).style.display = "none";//隐藏
                    }
                }
            }

            function exportToPdf() {//导出pdf
                document.getElementById("renderPdf").style.border = "0px";
                html2canvas(
                        document.getElementById("renderPdf"),
                        {
                            dpi: 172, //导出pdf清晰度
                            onrendered: function (canvas) {
                                var contentWidth = canvas.width;
                                var contentHeight = canvas.height;
                                //一页pdf显示html页面生成的canvas高度;
                                var pageHeight = contentWidth / 592.28 * 841.89;
                                //未生成pdf的html页面高度
                                var leftHeight = contentHeight;
                                //pdf页面偏移
                                var position = 0;
                                //html页面生成的canvas在pdf中图片的宽高（a4纸的尺寸[595.28,841.89]）
                                var imgWidth = 595.28;
                                var imgHeight = 592.28 / contentWidth * contentHeight;

                                var pageData = canvas.toDataURL('image/jpeg', 1.0);
                                var pdf = new jsPDF('', 'pt', 'a4');

                                //有两个高度需要区分，一个是html页面的实际高度，和生成pdf的页面高度(841.89)
                                //当内容未超过pdf一页显示的范围，无需分页
                                if (leftHeight < pageHeight) {
                                    pdf.addImage(pageData, 'JPEG', 0, 0, imgWidth, imgHeight);
                                } else {
                                    while (leftHeight > 0) {
                                        pdf.addImage(pageData, 'JPEG', 0, position, imgWidth, imgHeight)
                                        leftHeight -= pageHeight;
                                        position -= 841.89;
                                        //避免添加空白页
                                        if (leftHeight > 0) {
                                            pdf.addPage();
                                        }
                                    }
                                }
                                pdf.save('中南地区赛参赛回执.pdf');
                            },
                            //背景设为白色（默认为黑色）
                            background: "#fff"
                        })
                document.getElementById("renderPdf").style.border = "1px solid #000";
            }
           </script>
    </body>
</html>
